<?php

namespace app\admin\controller;

use app\Param;
use app\model\AdminPassport as ModelAdminPassport;

class Common extends Param
{
    protected $str_module_name = 'admin';

    public function _initialize()
    {
        parent::_initialize();
    }

    /**
     * 验证passport 返回登录的管理员编号
     * @return int
     */
    protected function _checkPassport()
    {
        $str_passport = $this->_getContentParams('passport');

        $str_platfrom = $this->_getParams('platfrom');

        _toValidate('passport', $str_passport, 12019);

        $int_admin_id = ModelAdminPassport::getInstance()->getAdminId($str_passport, $str_platfrom);

        _toValidate('id', $int_admin_id, 12019);

        return $int_admin_id;
    }
}
